package dao;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import model.Cliente;
import model.Log;

/**
 * @author usuario
 *
 */
public class LogDAO extends GenericoDAO<Log>{

	/**
	 * @param pathName
	 */
	public LogDAO() {
		super("log.csv");
	}

	@Override
	public List<Log> carregar() throws Exception {
		ArrayList<Log> logs = null;
		logs = new ArrayList<Log>();
		Log log = null;
		String prop = null;
		do {
			prop = buffer.readLine();
			if (prop == null) {
				break;
			}

			String[] apsTexto = prop.split(";");
			String[] campos = null;

			for (String s : apsTexto) {
				campos = s.split(",");
				log = new Log(campos[0],new Date(Long.parseLong(campos[1])));
				logs.add(log);
			}
		} while (true);

		arq.close();

		return logs;
	}

	@Override
	public void salvar(List<Log> objets) throws Exception {
		// TODO Auto-generated method stub
		
	}

}
